import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class MoleGameTest {
    @BeforeMethod
    public void setup() {
        // 重置初始地⿏位置
        MoleGame.setMolePosition(5);
    }
    @Test
    public void testHitCorrectPosition() {
        Assert.assertTrue(MoleGame.checkHit(5), "位置5应该命中");
    }
    @Test
    public void testMissLowerPosition() {
        Assert.assertFalse(MoleGame.checkHit(3), "位置3不应该命中");
    }
    @Test
    public void testMissHigherPosition() {
        Assert.assertFalse(MoleGame.checkHit(9), "位置9不应该命中");
    }
    @Test
    public void testHitEdgeCaseMin() {
        MoleGame.setMolePosition(1);
        Assert.assertTrue(MoleGame.checkHit(1), "位置1应该命中");
    }
    @Test
    public void testHitEdgeCaseMax() {
        MoleGame.setMolePosition(9);
        Assert.assertTrue(MoleGame.checkHit(9), "位置9应该命中");
    }
}
